package Game;

import Game.ActionType;
import Game.Block;

import java.util.ArrayList;

public class GameBox {
    protected int width, height;
    public int [][] tags ;//用于标定逻辑位置

    //static public Game.CollisionDetector collisionDetector;
    public int getWidth(){
        return this.width;
    }
    public int getHeight(){
        return this.height;
    }

    public ArrayList<Block> blocks;//用于渲染

    public GameBox(int width , int height){
        this.width = width;
        this.height = height;
        this.tags = new int [width][height];
        for (int i = 0 ; i < width ; i ++){
            for (int j = 0 ; j < height ; j ++){
                this.tags[i][j] = 0 ;
            }
        }

        this.blocks = new ArrayList<>();
    }

    public void place(Group g){
        //将逻辑位置修正为物理位置
        for (Block block : g.blocks){
            block.position.setY(block.position.getY() + g.position.getY());
            block.position.setX(block.position.getX() + g.position.getX());
            this.blocks.add(block);

            //记录方块位置
            this.tags[block.position.getX()][block.position.getY()] = 1 ;
        }
    }

    public boolean stranded (Group g){
        return false;
    }

    public boolean collisionDetect(Group g , ActionType action){
        //碰撞检测
        return false ;
    }



}

